All Functions Used So Far, Week 2

slice

{dplyr}

Subset rows using their positions

range

{base}

Return range of values

max

{base}

Get maximum of a vector

setwd

{base}

Set Working Directory

factor

{base}

Create a factor

read_excel

{readxl}

Read an Excel file

ncol

{base}

Get number of columns of a data frame

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

ggtitle

{GGPLOT2}

Generates a title for a ggplot graph

filter

{dplyr}

Filter out rows of a data frame according to logical vector

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

mean

{base}

Get mean of a vector

cbind

{base}

Combine R objects by columns

ls.str

{utils}

Similarly to ls, with a print() method that calls str() on each object

library

{base}

Load an R package

mutate

{dplyr}

Modify/create a column in a data frame

str

{utils}

Get the structure of an R object

nrow

{base}

Get number of rows of a data frame

is.na

{base}

Check if a value is NA/elements of vector are NA

names

{base}

Retrieve names of a list/vector

labs

{GGPLOT2}

Customise labels in GGPLOT2

min

{base}

Get minimum of a vector

desc

{dplyr}

Arrange in descending order

seq

{base}

Create a sequence

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

ifelse

{base}

Return a or b depending on the value of test

class

{base}

Retrieve class of an R object

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

attach

{base}

Attach Set of R Objects to Search Path

View

{base}

View a data frame

read.spss

{foreign}

Read a .sav file (SPSS data)

rbind

{base}

Combine R objects by rows

median

{stats}

Get median of a vector

var

{stats}

Calculate variance

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

boxplot

{graphics}

Plot a simple box plot

hist

{graphics}

Plot a simple histogram

sd

{stats}

Get standard deviation of a vector

dim

{base}

Get dimensions of a data frame

rm

{base}

Remove objects

ordered

{dplyr}

Create an ordered factor

geom_bar

{GGPLOT2}

Generates a bar chart

summary

{base}

Obtain summary statistics or detailed regression output

head

{utils}

Show first 5 rows of a data frame

cut

{base}

Convert Numeric to Factor

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

recode

{dplyr}

Recode a variable

ggplot

{GGPLOT2}

Create a ggplot graph

geom_histogram

{GGPLOT2}

Generates a histogram

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

lprop

{questionr}

Display row percentages of a two-way frequency table

select

{dplyr}

Select columns from a tibble/data frame

sum

{base}

Get sum of numeric values or a vector

pie

{graphics}

Creates a basic pie chart

install.packages

{base}

Install R package

plot

{graphics}

Generic function from base R to produce a plot

c

{base}

Combine values/vectors into a vector

levels

{base}

Get levels of a factor

ungroup

{dplyr}

Resolve grouping created with “group_by”

freq

{questionr}

Generate frequency tables

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

The end!